#include<iostream>
using namespace std;
int main(){
   int s=0,x,n,i,k;
   cin>>x;
   while(1){
   	   k=x;
       while(k!=0){
         s+=k%10;
         k/=10;
       } 
       x--;
       if(x==0)
         break;
   }
   cout<<s<<endl;
   return 0;
} 
